var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
      classes:[],
      active: "teacher"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      this.getData()
  },
  onToSignin: function(e) {
    console.log(e)
    let no = e.currentTarget.dataset.no
    wx.navigateTo({
      url: '/pages/tsignin/tsignin?no=' + no,
    })
  },
  onShow: function() {
    this.getData()
  },
  onChange(event) {
    console.log(event.detail)
    this.setData({
      active: event.detail,
    });

    let that = this
    console.log("/pages/" + that.data.active + "/" + that.data.active)
    wx.navigateTo({
      url: "/pages/" + that.data.active + "/" + that.data.active
    })
  },
  getData() {
    wx.cloud.callFunction({
      name: 'getTclass',
      data: {

      }
    }).then(res => {
      console.log(res)
      this.setData({
        classes: res.result.data
      })
    }).catch(res => {
      console.log(res)
    })
  }
})